package com.cat.slidingWindow;

import java.util.HashSet;

/**
*   @description https://leetcode.cn/problems/check-if-a-string-contains-all-binary-codes-of-size-k/
*   @author 曲大人的喵
*   @create 2025/9/16 22:24
*   @since JDK17
*/

public class Solution33 {
    public boolean hasAllCodes(String s, int k) {
        int n = s.length();
        HashSet<String> set = new HashSet<>();
        for (int r = k; r < n; r++) {
            String t = s.substring(r - k, r);   //
            set.add(t);
        }
        return set.size() == 1 << k;
    }
}
